/*
 * Copyright (C) 2010 LianHaidong <lianhaidong@gmail.com>
 */

#include <string.h>
#include <openssl/md5.h>
#include "utils/debug.h"

char *my_md5(unsigned char *dst, const unsigned char *src, int src_len)
{
	unsigned char buf[16];
	int i;

	if (!MD5(src, src_len, buf)) {
		msg("MD5 fail !!!");
		return NULL;
	}

	for (i = 0; i < 16; i++) {
		sprintf(dst + i * 2, "%02X", buf[i]);
	}

	dst[32] = '\0';

	return dst;
}


